var sms = "off";

function initSystemButton(){
	
	var page = "my";
	page = $("#menujs").attr("src").split("?")[1];
	//构造当前目录样式cookie
	if($.cookie){
		$.cookie.json = true;
		var mm = $.cookie('mm');
		//check cookie
		if(!mm){
			mm = {action:"list",current:"",before:"",parm:""};
			$.cookie('mm', mm,{expires:10,path: '/'});
		}else{
			mm.parm = "";
		}
		$(".systembutton").live("click",function(){
			mm.before 	= mm.current;
			mm.current 	= $(this).attr("key");
			mm.parm 	= $(this).attr("parm");
			var gotopage = "yes";
			//alertx(mm.action,$(this).attr("act"));
			/*if(mm.action=="edit"&&site.title!="dashboard"){
				if(!confirm("您正在离开编辑页面,请离开前保存好您的信息.是否确定离开?"))
					gotopage = "no";
			}*/
			mm.action 	= $(this).attr("act");
			//save cookie
			$.cookie('mm', mm,{expires:10,path: '/'});
			if(gotopage=="yes"){
				var url = site.web+ page +'/'+mm.current;
				if(mm.parm)
					url += mm.parm;
				window.location = url;
			}
		});
	}
}

function setMM(action){
	$.cookie.json = true;
	var mm = $.cookie('mm');
	//check cookie
	if(!mm){
		mm = {action:action,current:"",before:"",parm:""};
	}else{
		mm.action = action;
	}
	$.cookie('mm', mm,{expires:10,path: '/'});
}

function alertx(){//打印多个参数 20130615 by vincent
	var str = "";
	for(var i=0;i<arguments.length;i++){    
	    str += (i+1)+'：'+arguments[i]+'\n'; 
	}
	alert(str);
}

$(function() {//子菜单显示样式
	initSystemButton();
	if(site.def=="dashboard"){
			$(".nav-menu").hide();
		} 	
}); 